package thread;


class myThread extends Thread{
    @Override
    public void run(){
        while (true) {
            System.out.println("hello thread");
            try {
                Thread.sleep(1000);
            }
            catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


    }
}
public class Demo1 {

    public static void main(String[] args) {
        System.out.println("你好");
        myThread thread=new myThread();
        // thread.run();
        thread.start();//开启线程，执行run方法，输出
    }
}
